package org.example.testdemo.controller;

import jakarta.annotation.Resource;
import org.example.testdemo.service.AccountingIntervalService;
import org.example.testdemo.service.FinancialYearService;
import org.example.testdemo.tool.ApiResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("financialYear")
public class FinancialYearController {

    @Resource
    private FinancialYearService yearService;

    @Resource
    private AccountingIntervalService intervalService;

    @PostMapping("getYearAndMonth")
    public ApiResponse getYearAndMonth(){
        Map<String,Object> objectMap =new HashMap<>();
        objectMap.put("year",yearService.findByAll());
        objectMap.put("month",intervalService.findByAll());
        return ApiResponse.success(objectMap);
    }

}
